package net.optix.ip.commands
{
	import com.adobe.cairngorm.business.Responder;
	import com.adobe.cairngorm.commands.Command;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import net.optix.ip.business.*;
	import net.optix.ip.events.GetCopyrightActionsEvent;
	import net.optix.ip.model.ModelLocator;
	
	public class GetCopyrightActionsCommand implements Command, Responder
	{
		// attributes ============================
		private var model:ModelLocator = ModelLocator.getInstance();


		// functions ============================
		public function execute( event:CairngormEvent ) : void
		{
			var myEvent:GetCopyrightActionsEvent = GetCopyrightActionsEvent( event );
			
			var delegate:CopyrightDelegate = new CopyrightDelegate();     
			delegate.getCopyrightActions( this,myEvent.copyrightID );
		}
		
		//----------------------------------------------------------------------------
		public function onResult( event : * = null ) : void
		{
			trace(event.result);
			try
			{
				model.actions	=	event.result;
				
				
			}
			catch(error:Error)
			{
				
			}
		}
		
		//----------------------------------------------------------------------------
		public function onFault( event : * = null ) : void
		{
			model.result	=	"Program error";	
			model.bSubmit	=	true;
			trace(event.fault);
		}

	}
}